<script lang="ts" setup name="">
import { ref, reactive } from "vue";
import { useRouter } from "vue-router";
import JxudpDataSourceForm from "./component/jxudp-data-source-form.vue";
import { redirectPath } from "@/utils/router-kit";
import { JxudpDataSourceEditUrl } from "@/views/org/mapping.json";
const router = useRouter();
const JxudpDataSourceFormRef = ref<InstanceType<typeof JxudpDataSourceForm> | null>(null);
const JxudpDataSourceFormState = reactive({
  dataSourceId: router.currentRoute.value.params.id as string,
  saveForm: () => JxudpDataSourceFormRef.value.save(),
  /**新增成功 跳转页面 */
  onAddFormSuccess: (formData: any) => {
    redirectPath(JxudpDataSourceEditUrl + formData.dataSourceId);
  }
});
</script>
<template>
  <jxudp-data-source-form
    ref="JxudpDataSourceFormRef"
    :data-source-id="JxudpDataSourceFormState.dataSourceId"
    @add-success="JxudpDataSourceFormState.onAddFormSuccess"
  ></jxudp-data-source-form>
</template>
